<template>
  <div>
    <!-- :rules="rules" -->
    <el-form
      :model="Info"
      :rules="rules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
      <el-card class="box-card">
        <el-row>
          <el-col :span="2">
            <div
              style="width: 6%; border: 1px solid white; background-color: cornflowerblue; text-align: center; position: fixed;"
              >
              <span style="color: white; line-height: 100px">基本信息填写</span>
            </div>
            <div
              style=" width: 6%;  border: 1px solid white;background-color: cornflowerblue; text-align: center; margin-top: 100px; position: fixed;"
              >
              <span style="color: white; line-height: 100px">经费预算</span>
            </div>
            <div
              style=" width: 6%;  border: 1px solid white; background-color: cornflowerblue; text-align: center; margin-top: 200px; position: fixed;"
              >
              <span style="color: white; line-height: 100px">上传附件</span>
            </div>
            <div
              style=" width: 6%;  border: 1px solid white; background-color: cornflowerblue; text-align: center; margin-top: 300px; position: fixed;"
              >
              <span style="color: white; line-height: 100px">其他</span>
            </div>
          </el-col>
          <el-col :span="22">
            <div id="page1">
              <span
                style="
                  color: cornflowerblue;
                  font-size: 20px;
                  line-height: 50px;
                "
                >基本信息填写</span
              >&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #d3dce6"
                >请点击<i class="el-icon-search"></i
                >按钮选择相应申报信息关联</span
              >
              <el-divider></el-divider>
              <el-row>
                <!-- <p v-if="numFlag=='projectName'" style="color:red;line-height: 10px;height: 10px;"><span style="font-size: 13px;">{{ ps }}</span></p> -->
                <el-col :span="3">项目名称（中文）：</el-col>
                <el-col :span="21">
                  <el-form-item
                    label=" "
                    style="margin-left: -100px"
                    prop="projectName"
                  >
                    <el-input
                      v-model="Info.projectName"
                      style="width: 90%"
                    ></el-input
                    ><i class="el-icon-search"></i>
                  </el-form-item>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目编号：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectNumber"
                      >
                        <el-input
                          v-model="Info.projectNumber"
                          placeholder=""
                          style="width: 50%"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12"> </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">成果所属部门：</el-col>
                    <el-col :span="18">
                      <assemblyItem @AddDepart="AddDepart"></assemblyItem>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">负责人：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=""
                        style="margin-left: -100px"
                        prop="projectPerson"
                      >
                        <el-autocomplete
                          @change="isprojectPerson()"
                          v-model="Info.projectPerson"
                          class="ipt"
                          style="width: 30%; line-height: 19px"
                          :fetch-suggestions="querySearchAsync1"
                          placeholder=""
                          @select="handleSelect"
                        ></el-autocomplete>
                        <!-- <el-input v-model="Info.projectPerson" class="ipt" style="width: 30%;" /><i class="el-icon-search"></i> -->
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">负责人所属部门：</el-col>
                    <el-col :span="18">
                      <!-- <el-input v-model="Info.projectDepartperson" placeholder="由负责人提供" class="ipt"
                        style="width: 30%" /> -->
                      <GetDepart @GetDepart="GetDepart"></GetDepart>
                      <el-cascader
                        class=".el_Select"
                        placeholder=""
                        @change="ProjectUndertakingUnit()"
                        :options="DepartList"
                        v-model="Info.projectDepartperson"
                        style="width: 80%"
                        filterable
                      ></el-cascader>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">科研秘书：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectSecretary"
                      >
                        <el-autocomplete
                          @change="isprojectSecretary()"
                          v-model="Info.projectSecretary"
                          class="ipt"
                          style="width: 30%; line-height: 19px"
                          :fetch-suggestions="querySearchAsync1"
                          placeholder=""
                          @select="handleSelect1"
                        ></el-autocomplete>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">科研秘书联系方式：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="secretaryPhone"
                      >
                        <el-input
                          v-model="Info.secretaryPhone"
                          class="ipt"
                          style="width: 30%"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">负责人类型：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectPersontype"
                      >
                        <el-select
                          v-model="Info.projectPersontype"
                          placeholder="请选择"
                          style="width: 30%"
                          cass="ipt"
                        >
                          <el-option
                            v-for="item in projectPersontypeOptions"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                          >
                          </el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">立项年度：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectYear"
                      >
                        <el-date-picker v-model="Info.projectYear" type="year">
                        </el-date-picker>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">登记时间：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectWritetime"
                      >
                        <el-date-picker
                          :disabled="true"
                          v-model="Info.projectWritetime"
                          type="date"
                        >
                        </el-date-picker>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">登记人：</el-col>
                    <el-col :span="18">
                      <el-input
                        :disabled="true"
                        v-model="Info.projectWriteperson"
                        class="ipt"
                        style="width: 30%"
                      />
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目经费（万元）：</el-col>
                    <el-col :span="18">
                      <el-input
                        v-model="Info.projectMoney"
                        placeholder="由专项经费及配套经费组成"
                        :disabled="true"
                        class="ipt"
                        style="width: 38%; background-color: white"
                      />
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">专项经费（万元）：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="specialMoney"
                      >
                        <el-input
                          @change="sumMoney()"
                          type="number"
                          v-model="Info.specialMoney"
                          class="ipt"
                          style="width: 30%"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">配套经费（万元）：</el-col>
                    <el-col :span="18">
                      <el-input
                        @change="sumMoney1()"
                        :disabled="!Isdisable"
                        type="number"
                        v-model="Info.supportMoney"
                        class="ipt"
                        style="width: 30%; background-color: white"
                      />
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">学科门类：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectSubject"
                      >
                        <!-- <el-input v-model="Info.projectSubject" class="ipt" style="width: 30%" /> -->
                        <el-select
                          v-model="Info.projectSubject"
                          placeholder="请选择"
                          style="width: 30%"
                          cass="ipt"
                        >
                          <el-option
                            v-for="item in projectSubjectOptions"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                          >
                          </el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目开始时间：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectStarttime"
                      >
                        <el-date-picker
                          :disabled-date="BegindisabledDateFun"
                          v-model="Info.projectStarttime"
                          type="month"
                          placeholder="选择月"
                        >
                        </el-date-picker>
                        <!-- <el-date-picker v-model="Info.projectStarttime" type="date">
                        </el-date-picker> -->
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">结束时间：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectEndtime"
                      >
                        <el-date-picker
                          :disabled-date="EnddisabledDateFun"
                          v-model="Info.projectEndtime"
                          type="month"
                          placeholder="选择月"
                        >
                        </el-date-picker>
                        <!-- <el-date-picker v-model="Info.projectEndtime" type="date">
                        </el-date-picker> -->
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">研究类型：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectStudytype"
                      >
                        <el-select
                          v-model="Info.projectStudytype"
                          placeholder="请选择"
                          style="width: 30%"
                          class="ipt"
                        >
                          <el-option
                            v-for="item in projectStudytypeOptions"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                          >
                          </el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目类型：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectType"
                      >
                        <el-select
                          clearable
                          v-model="Info.projectType"
                          @change="typeProjectLevel()"
                          placeholder="请选择"
                          style="width: 30%"
                          cass="ipt"
                        >
                          <el-option
                            v-for="item in projectTypeOptions"
                            :key="item"
                            :label="item.dicValue"
                            :value="item.id"
                          >
                          </el-option>
                        </el-select>
                        <!-- <el-input v-model="Info.projectType" class="ipt" style="width: 30%" /><i
                          class="el-icon-search"></i> -->
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目级别：</el-col>
                    <el-col :span="18">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px"
                        prop="projectLevel"
                      >
                        <el-select
                          clearable
                          v-model="Info.projectLevel"
                          @change="projectLevelLevel()"
                          placeholder="根据项目类型选择"
                          style="width: 30%"
                          cass="ipt"
                        >
                          <el-option
                            v-for="item in projectLevelOptions"
                            :key="item"
                            :label="item.dicValue"
                            :value="item.id"
                          >
                          </el-option>
                        </el-select>
                        <!-- <el-input v-model="Info.projectLevel" class="ipt" style="width: 30%" /><i
                          class="el-icon-search"></i> -->
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目来源单位：</el-col>
                    <el-col :span="18">
                      <el-select
                        clearable
                        v-model="Info.projectScoreunit"
                        @change="projectScoreunitLevel()"
                        placeholder="根据项目级别选择"
                        style="width: 30%"
                        cass="ipt"
                      >
                        <el-option
                          v-for="item in projectScoreunitOptions"
                          :key="item"
                          :label="item.dicValue"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
                      <!-- <el-input v-model="Info.projectScoreunit" class="ipt" style="width: 30%" /><i
                        class="el-icon-search"></i> -->
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目类别：</el-col>
                    <el-col :span="18">
                      <el-select
                        clearable
                        v-model="Info.projectKind"
                        placeholder="根据项目来源单位选择"
                        style="width: 30%"
                        cass="ipt"
                      >
                        <el-option
                          v-for="item in projectKindOptions"
                          :key="item"
                          :label="item.dicValue"
                          :value="item.id"
                        >
                        </el-option>
                      </el-select>
                      <!-- <el-input v-model="Info.projectKind" class="ipt" style="width: 30%" /><i
                        class="el-icon-search"></i> -->
                    </el-col>
                  </el-row>
                </el-col>
              </el-row>
              <br />
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">项目承担单位：</el-col>
                    <el-col :span="18">
                      <!-- <el-input :disabled="true" v-model="Info.projectWriteperson"  class="ipt" style="width: 30%" /> -->
                      <el-input
                        v-model="Info.projectUndertakeunit"
                        :disabled="true"
                        placeholder="由负责人部门选择"
                        class="ipt"
                        style="width: 30%"
                      />
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12"> </el-col>
              </el-row>
              <br />
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="10"
                      >是否委托外单位进行测试或测试加工：</el-col
                    >
                    <el-radio v-model="Info.projectEntrust" :label="true"
                      >是</el-radio
                    >
                    <el-radio v-model="Info.projectEntrust" :label="false"
                      >否</el-radio
                    >
                  </el-row>
                </el-col>
                <el-col :span="12"> </el-col>
              </el-row>
              <br />
              <el-row v-if="Info.projectEntrust">
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">
                      <apan style="line-height: 100px">详细信息：</apan>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px; width: 1000px"
                        prop="projectRemark"
                      >
                        <el-input
                          type="textarea"
                          style="width: 1000px"
                          :rows="4"
                          placeholder="请输入内容"
                          v-model="Info.projectRemark"
                        >
                        </el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12"> </el-col>
              </el-row>
              <br />
              <el-row>
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">是否涉及人体：</el-col>
                    <el-radio v-model="Info.touchPerson" :label="true"
                      >是</el-radio
                    >
                    <el-radio v-model="Info.touchPerson" :label="false"
                      >否</el-radio
                    >
                  </el-row>
                </el-col>
                <el-col :span="12"> </el-col>
              </el-row>
              <br />
              <el-row v-if="Info.touchPerson">
                <el-col :span="12">
                  <el-row>
                    <el-col :span="6">
                      <apan style="line-height: 100px">详细信息：</apan>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item
                        label=" "
                        style="margin-left: -100px; width: 1000px"
                        prop="personRemark"
                      >
                        <el-input
                          type="textarea"
                          style="width: 1000px"
                          :rows="4"
                          placeholder="请输入内容"
                          v-model="Info.personRemark"
                        >
                        </el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-col>
                <el-col :span="12"> </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <br />
      </el-card>
    </el-form>
    <br />
    <el-card class="box-card">
      <div id="page2">
        <el-row>
          <el-col :span="2"> &nbsp; </el-col>
          <el-col :span="22">
            <span
              style="color: cornflowerblue; font-size: 20px; line-height: 50px"
              >经费预算</span
            >
            <el-divider></el-divider>
            <el-row>
              <el-col :span="12">
                <el-row>
                  <el-col :span="6">选择预算模板：</el-col>
                  <el-col :span="18">
                    <el-select
                      v-model="BudgetTemplate"
                      @change="Get_Fundtemplate_ItemList()"
                      placeholder="根据项目来源单位选择"
                      style="width: 30%"
                      class="ipt"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.fundtemplateId"
                        :label="item.fundtemplateName"
                        :value="item.fundtemplateId"
                      >
                      </el-option>
                    </el-select>
                  </el-col>
                </el-row>
              </el-col>
              <el-col :span="12">
                <el-row>
                  <el-col :span="6">是否包含配经费：</el-col>
                  <el-col :span="18">
                    <el-radio-group
                      v-model="Isdisable"
                      @change="IncludingAccessories()"
                    >
                      <el-radio :label="true">是</el-radio>
                      <el-radio :label="false">否</el-radio>
                    </el-radio-group>
                    <!-- <el-radio v-model="Isdisable"  :label=true>是</el-radio>
                    <el-radio v-model="Isdisable" @click="IncludingAccessories()" :label=false>否</el-radio> -->
                  </el-col>
                </el-row>
              </el-col>
            </el-row>
            <br />
            <el-row>
              <el-col :span="24">
                <table
                  v-loading="loading"
                  style="
                    width: 90%;
                    text-align: center;
                    border-collapse: collapse;
                  "
                >
                  <tr>
                    <td
                      style="line-height: 50px"
                      colspan="4"
                      class="table_style"
                    >
                      项目经费预算
                    </td>
                  </tr>
                  <tr>
                    <td
                      :rowspan="Fundtemplate_ItemList.length + 1"
                      style="width: 10%"
                      class="table_style1"
                    >
                      直接费用
                    </td>
                    <td class="table_style1">预算科目</td>
                    <td class="table_style1">预算金额（专项经费：千元）</td>
                    <td class="table_style1">预算金额（配套经费：千元）</td>
                  </tr>
                  <tr
                    v-for="(item, index) in Fundtemplate_ItemList"
                    :key="index"
                  >
                    <td class="table_style1">{{ item.budgetitemName }}</td>
                    <td class="table_style1" v-if="item.children.length == 0">
                      <!-- onkeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))"  -->
                      <input
                        :inline="true"
                        :min="0"
                        :step="0.1"
                        v-model="Fundtemplate_ItemListZ[index].directFunding"
                        style="width: 90%; height: 80%"
                        type="number"
                      />
                      <!-- <input type="number" :min="0" v-model="
                        Fundtemplate_ItemListZ[index - 1].directFunding
                      " :step-strictly="true" style="width: 90%; height: 80%" placeholder="" /> -->
                    </td>
                    <td class="table_style1" v-if="item.children.length == 0">
                      <!-- /[\d]/.test(String.fromCharCode(event.keyCode)) -->
                      <!-- onkeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))"  -->
                      <input
                        :inline="true"
                        :min="0"
                        :step="0.1"
                        :disabled="!Isdisable"
                        v-model="Fundtemplate_ItemListZ[index].overheadFunding"
                        style="width: 90%; height: 80%"
                        type="number"
                      />
                      <!-- <el-input :inline="true" v-model="Fundtemplate_ItemListZ[index - 1].overheadFunding" onKeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))" type="number"></el-input> -->
                      <!-- <input type="number" :min="0" @change="handleChange()"
                        :disabled="!Isdisable" v-model="
                          Fundtemplate_ItemListZ[index - 1].overheadFunding
                        " style="width: 90%; height: 80%" /> -->
                    </td>
                    <td
                      class="table_style1"
                      v-if="item.children.length != 0"
                    ></td>
                    <td
                      class="table_style1"
                      v-if="item.children.length != 0"
                    ></td>
                  </tr>
                  <tr v-if="indirectCosts.length != 0">
                    <td
                      :rowspan="indirectCosts.length + 1"
                      style="width: 10%"
                      class="table_style1"
                    >
                      间接费用
                    </td>
                    <td class="table_style1">预算科目</td>
                    <td class="table_style1">预算金额（专项经费：千元）</td>
                    <td class="table_style1">预算金额（配套经费：千元）</td>
                  </tr>
                  <tr v-for="(item, index) in indirectCosts" :key="index">
                    <td class="table_style1">{{ item.budgetitemName }}</td>
                    <td class="table_style1" v-if="item.children.length == 0">
                      <!-- onkeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))"  -->
                      <input
                        :inline="true"
                        :min="0"
                        :step="0.1"
                        v-model="Fundtemplate_ItemListJ[index].directFunding"
                        style="width: 90%; height: 80%"
                        type="number"
                      />
                      <!-- <input type="number" :min="0" v-model="
                        Fundtemplate_ItemListJ[index - 1].directFunding
                      " style="width: 90%; height: 80%" /> -->
                    </td>
                    <!-- onkeypress="return(/[\d]/.test(String.fromCharCode(event.keyCode)))"  -->
                    <td class="table_style1" v-if="item.children.length == 0">
                      <input
                        :inline="true"
                        :min="0"
                        :disabled="!Isdisable"
                        :step="0.1"
                        v-model="Fundtemplate_ItemListJ[index].overheadFunding"
                        style="width: 90%; height: 80%"
                        type="number"
                      />
                      <!-- <input type="number" :min="0" :disabled="!Isdisable" v-model="
                        Fundtemplate_ItemListJ[index - 1].overheadFunding
                      " style="width: 90%; height: 80%" placeholder="" /> -->
                    </td>
                    <td
                      class="table_style1"
                      v-if="item.children.length != 0"
                    ></td>
                    <td
                      class="table_style1"
                      v-if="item.children.length != 0"
                    ></td>
                  </tr>
                  <tr>
                    <td colspan="2" class="table_style1">
                      <b>总金额：（千元）</b>
                    </td>
                    <td class="table_style1">
                      <input
                        v-model="sumSpecialMoney"
                        class="el-input__inner"
                        placeholder=""
                      />
                    </td>
                    <td class="table_style1">
                      <input
                        v-model="sumSupportMoney"
                        class="el-input__inner"
                        placeholder=""
                      />
                    </td>
                  </tr>
                </table>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
      </div>
    </el-card>
    <br />
    <el-card class="box-card">
      <div id="page3">
        <el-row>
          <el-col :span="2"> &nbsp; </el-col>
          <el-col :span="22">
            <span
              style="color: cornflowerblue; font-size: 20px; line-height: 50px"
              >上传附件</span
            >
            <el-divider></el-divider>
            <!-- <el-upload action="http://localhost:9991/api/depart/UploadImgToQiNiu" list-type="picture-card"
              :on-success="Upic">
              <i class="el-icon-plus"></i>
            </el-upload> -->
            <el-upload
              class="upload-demo"
              drag
              action="http://localhost:9991/api/tb_project_appendix/UploadImgToQiNiu"
              style="width: 90%"
              multiple
              :on-success="Upic"
            >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                将文件拖到此处，或<em>点击上传</em>
              </div>
              <div class="el-upload__tip">
                只能上传.jpg, .jpeg, .png, .gif, .doc, .docx, .pdf, .xls, .xlsx
                , .txt文件，且不超过2MB
              </div>
            </el-upload>
          </el-col>
        </el-row>
      </div>
    </el-card>
    <br />
    <el-row>
      <el-col :span="2">&nbsp;</el-col>
      <el-col :span="22">
        <el-button @click="Personnelinformation = '人员信息'"
          >人员信息</el-button
        ><el-button @click="Personnelinformation = '计划与目标'"
          >计划与目标</el-button
        ><el-button @click="Personnelinformation = '预期成果'"
          >预期成果</el-button
        >
      </el-col>
    </el-row>
    <br />
    <div id="page4">
      <el-card v-if="Personnelinformation == '人员信息'" class="box-card">
        <el-row>
          <el-col :span="2"> &nbsp; </el-col>
          <el-col :span="22">
            <span
              style="color: cornflowerblue; font-size: 20px; line-height: 50px"
              >人员信息</span
            >
            <el-divider></el-divider>
            <table
              style="width: 100%; text-align: center; border-collapse: collapse"
            >
              <thead>
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                >
                  <td
                    style="line-height: 50px"
                    colspan="11"
                    class="table_style"
                  >
                    项目经费预算
                  </td>
                </tr>
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                >
                  <td class="table_style">
                    <span class="text___size">序号</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">参与类别</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">人员姓名</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">所属单位</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">现专业技术职务</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">目前参加其他项目数</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">在本项目中责任分工</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size"
                      >投入本项目计划的全时工作时间(月)</span
                    >
                  </td>
                  <td class="table_style">
                    <span class="text___size">每月资助标准</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">经费合计</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">操作</span>
                  </td>
                </tr>
              </thead>
              <tbody
                style="
                  display: block;
                  overflow-x: hidden;
                  overflow-y: auto;
                  height: 220px;
                "
              >
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                  v-for="item in NumberofpersonnelList.length"
                  :key="item"
                >
                  <td class="table_style">{{ item }}</td>
                  <td class="table_style">
                    <select
                      @change="GetUpdate(item)"
                      v-model="
                        this.NumberofpersonnelList[item - 1].participantsType
                      "
                      style="width: 100px; height: 20px"
                    >
                      <option label="本单位" :value="0"></option>
                      <option label="外单位" :value="1"></option>
                    </select>
                  </td>
                  <td class="table_style">
                    <select
                      v-if="
                        this.NumberofpersonnelList[item - 1].participantsType ==
                        0
                      "
                      v-model="
                        this.NumberofpersonnelList[item - 1].participantsName
                      "
                      style="width: 100px; height: 20px"
                    >
                      <option
                        v-for="item in restaurants1"
                        :key="item"
                        :label="item.value"
                        :value="item.id"
                      ></option>
                    </select>
                    <input
                      v-if="
                        this.NumberofpersonnelList[item - 1].participantsType ==
                        1
                      "
                      v-model="
                        this.NumberofpersonnelList[item - 1].participantsName
                      "
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="
                        this.NumberofpersonnelList[item - 1].affiliatedUnit
                      "
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="
                        this.NumberofpersonnelList[item - 1].participantsJob
                      "
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="
                        this.NumberofpersonnelList[item - 1].projectQuantity
                      "
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="
                        this.NumberofpersonnelList[item - 1].projectDivision
                      "
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="
                        this.NumberofpersonnelList[item - 1].workingHours
                      "
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="this.NumberofpersonnelList[item - 1].salary"
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    {{
                      this.NumberofpersonnelList[item - 1].salary *
                      this.NumberofpersonnelList[item - 1].workingHours
                    }}
                  </td>
                  <td class="table_style">
                    <el-link type="danger" @click="DelNumberofpersonnel(item)"
                      >删除</el-link
                    >
                  </td>
                </tr>
              </tbody>
            </table>
            <br />
            <el-button type="primary" @click="AddNumberofpersonnel()"
              ><span style="font-size: 20px; line-height: 10px"
                >+</span
              ></el-button
            >
          </el-col>
        </el-row>
      </el-card>
      <el-card v-if="Personnelinformation == '计划与目标'" class="box-card">
        <el-row>
          <el-col :span="2"> &nbsp; </el-col>
          <el-col :span="22">
            <span
              style="color: cornflowerblue; font-size: 20px; line-height: 50px"
              >计划与目标</span
            >
            <el-divider></el-divider>
            <table
              style="width: 100%; text-align: center; border-collapse: collapse"
            >
              <thead>
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                >
                  <td style="line-height: 50px" colspan="6" class="table_style">
                    计划与目标
                  </td>
                </tr>
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                >
                  <td class="table_style">
                    <span class="text___size">序号</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">开始时间</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">结束时间</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">计划</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">目标</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">操作</span>
                  </td>
                </tr>
              </thead>
              <tbody
                style="
                  display: block;
                  overflow-x: hidden;
                  overflow-y: auto;
                  height: 220px;
                "
              >
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                  v-for="item in PlanAndObjectivesList.length"
                  :key="item"
                >
                  <td class="table_style">{{ item }}</td>
                  <td class="table_style">
                    <input
                      v-model="this.PlanAndObjectivesList[item - 1].startTime"
                      @change="
                        DateJudge(
                          this.PlanAndObjectivesList[item - 1].startTime,
                          this.PlanAndObjectivesList[item - 1].endTime,
                          item
                        )
                      "
                      type="date"
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="this.PlanAndObjectivesList[item - 1].endTime"
                      @change="
                        DateJudge(
                          this.PlanAndObjectivesList[item - 1].startTime,
                          this.PlanAndObjectivesList[item - 1].endTime,
                          item
                        )
                      "
                      type="date"
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="this.PlanAndObjectivesList[item - 1].plan"
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <input
                      v-model="this.PlanAndObjectivesList[item - 1].target"
                      style="width: 95%; height: 30px"
                    />
                  </td>
                  <td class="table_style">
                    <el-link
                      type="danger"
                      @click="DelPlanAndObjectivesList(item)"
                      >删除</el-link
                    >
                  </td>
                </tr>
              </tbody>
            </table>
            <br />
            <el-button type="primary" @click="AddPlanAndObjectivesList()"
              ><span style="font-size: 20px; line-height: 10px"
                >+</span
              ></el-button
            >
          </el-col>
        </el-row>
      </el-card>
      <el-card v-if="Personnelinformation == '预期成果'" class="box-card">
        <el-row>
          <el-col :span="2"> &nbsp; </el-col>
          <el-col :span="22">
            <span
              style="color: cornflowerblue; font-size: 20px; line-height: 50px"
              >预期成果</span
            >
            <el-divider></el-divider>
            <table
              style="width: 100%; text-align: center; border-collapse: collapse"
            >
              <thead>
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                >
                  <td style="line-height: 50px" colspan="3" class="table_style">
                    预期成果
                  </td>
                </tr>
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                >
                  <td class="table_style">
                    <span class="text___size">序号</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">预期成果</span>
                  </td>
                  <td class="table_style">
                    <span class="text___size">操作</span>
                  </td>
                </tr>
              </thead>
              <tbody
                style="
                  display: block;
                  overflow-x: hidden;
                  overflow-y: auto;
                  height: 220px;
                "
              >
                <tr
                  style="
                    display: table;
                    width: 100%;
                    table-layout: fixed;
                    word-break: break-all;
                  "
                  v-for="item in ExpectedSuccess.length"
                  :key="item"
                >
                  <td class="table_style">{{ item }}</td>
                  <td class="table_style">
                    <el-input
                      type="textarea"
                      :rows="2"
                      placeholder="请输入内容"
                      v-model="ExpectedSuccess[item - 1].results"
                    >
                    </el-input>
                  </td>
                  <td class="table_style">
                    <el-link type="danger" @click="DelExpectedSuccess(item)"
                      >删除</el-link
                    >
                  </td>
                </tr>
              </tbody>
            </table>
            <br />
            <el-button type="primary" @click="AddExpectedSuccess()"
              ><span style="font-size: 20px; line-height: 10px"
                >+</span
              ></el-button
            >
          </el-col>
        </el-row>
      </el-card>
    </div>
    <br />
    <div style="width: 100%; text-align: center">
      <el-button type="primary" @click="Staging()">暂存</el-button>
      <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
    </div>
    <br />
    &nbsp;
  </div>
</template>

<script>
///雪花id
// import SnowflakeId from "snowflake-id";
// const snowflake = new SnowflakeId({
//     mid: 42,
//     offset: (2019 - 1970) * 31536000 * 1000
// });
import assemblyItem from "@/assembly/DepartSon.vue";
import GetDepart from "@/assembly/DepartList.vue";
export default {
  components: { GetDepart },
  components: { assemblyItem },
  data() {
    var checkAge = (rule, value, callback) => {
      if (!value) {
        return callback(new Error("项目名称不能为空"));
      }
      let regNum = /[^\u4E00-\u9FA5]/g;
      if (regNum.test(value)) {
        callback(new Error("只能输入中文"));
      }
      if (value.length > 255) {
        callback(new Error("超出最大长度"));
      }
      this.http
        .get("api/tb_project_baseinfo/ProjectNameSole?projectName=" + value)
        .then((res) => {
          console.log(res);
          if (!res.data) {
            callback(new Error("已有此项目名称"));
          } else {
            callback();
          }
        });
    };
    var chackPhone = (rule, value, callback) => {
      if (!value) {
        return callback(new Error("手机号不能为空"));
      }
      let regPhone = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
      if (!regPhone.test(value)) {
        callback(new Error("手机号格式不正确"));
      } else {
        callback();
      }
    };
    var chackNumber = (rule, value, callback) => {
      if (value.length > 255) {
        callback(new Error("超出最大长度"));
      }
      this.http
        .get("api/tb_project_baseinfo/ProjectNumSole?projectNum=" + value)
        .then((res) => {
          console.log(res);
          if (!res.data) {
            callback(new Error("项目编号不能重复"));
          } else {
            callback();
          }
        });
    };
    return {
      //id:snowflake.generate(),
      Personnelinformation: "人员信息",
      PlanAndObjectivesList: [
        {
          startTime: "",
          endTime: "",
          plan: "",
          target: "",
          //projectId: ""
        },
      ],
      NumberofpersonnelList: [
        {
          participantsType: 0, //参与人类别
          participantsName: "", //参与人姓名
          affiliatedUnit: "", //所属单位
          participantsJob: "", //参与人现专业技术职务
          projectQuantity: 0, //现参与项目数量
          projectDivision: "", //责任分工
          workingHours: 0, //投入本项目计划工作时间
          salary: 0, //每月资助标准
        },
      ],
      ExpectedSuccess: [
        {
          results: "",
          //projectId: "string"
        },
      ],
      ps: "",
      projectScoreunitOptions: [],
      projectSubjectOptions: [], //学科门类
      projectStudytypeOptions: [], //研究类型
      projectUndertakeunitOptions: [], //项目承担单位
      projectTypeOptions: [], //项目类型
      restaurants: [],
      restaurants1: [],
      projectKindOptions: [],
      state: "",
      timeout: null,
      loading: false,
      visible: false,
      Isdisable: true,
      StartTime: new Date(),
      count1: 10,
      DepartList: [],
      BudgetTemplate: "",
      values: "",
      fundingsubject: [],
      projectType: "",
      projectDepartresult: "",
      Info: {
        projectName: "", //项目名称(中文)
        projectNumber: "", //项目编号
        projectDepartresult: "", //成果归属部门
        projectDepartperson: "", //负责人所属部门
        secretaryPhone: "", //科研秘书联系方式
        projectYear: 0, //立项年度
        projectWriteperson: JSON.parse(localStorage.getItem("user")).userName, //登记人
        specialMoney: 0, //专项经费(万元)
        projectSubject: "", //学科门类
        projectEndtime: "", //结束时间
        projectType: "", //项目类型
        projectScoreunit: "", //项目来源单位
        projectUndertakeunit: "", //项目承担单位
        projectEntrust: false, //是否委托外单位进行测试或测试加工
        projectRemark: "", //备注
        touchPerson: false, //是否涉及人体
        personRemark: "", //人体补充
        projectPerson: "", //负责人
        projectSecretary: "", //科研秘书(负责成果、经费)
        projectPersontype: "", //负责人类型
        projectWritetime: new Date(), //, //登记时间
        projectMoney: 0, //项目经费 (万元)
        supportMoney: 0, //配套经费(万元)
        projectStarttime: "", //项目开始时间
        projectStudytype: "", //研究类型
        projectLevel: "", //项目级别
        projectKind: "", //项目类别
        isDel: 0,
        isTs: true,
        data: [
          // {
          //   templateId: "",
          //   subjectId: "",
          //   projectId: "",
          //   directFunding: 0,
          //   overheadFunding: 0
          // }
        ],
        file: [],
        dataone: [],
        datatwo: [],
        datathree: [],
        //data:[],
      },
      projectLevelOptions: [],
      LevelOptions: [],
      options: [],
      Fundtemplate_ItemList: [],
      Fundtemplate_ItemListZ: [
        {
          templateId: this.BudgetTemplate, //经费模板Id
          subjectId: "", //经费科目Id
          projectId: "", //项目Id
          directFunding: 0, //专项经费
          overheadFunding: 0, //配套经费
        },
      ],
      Fundtemplate_ItemListJ: [
        {
          templateId: this.BudgetTemplate, //经费模板Id
          subjectId: "", //经费科目Id
          projectId: "", //项目Id
          directFunding: 0, //专项经费
          overheadFunding: 0, //配套经费
        },
      ],
      projectPersontypeOptions: [], //负责人类型
      indirectCosts: [],
      getPageData: {
        page: 0,
        rows: 0,
        total: 0,
        tableName: "",
        sort: "",
        order: "",
        wheres: "",
        export: true,
      },
      rules: {
        projectName: [
          { required: true, validator: checkAge, trigger: "blur" },
          //{ required: true, message: "请输项目名称", trigger: "change" },
        ],
        secretaryPhone: [
          { required: true, validator: chackPhone, trigger: "blur" },
          //{ required: true, message: "请输入手机号", trigger: "change" },
        ],
        projectNumber: [
          { required: true, validator: chackNumber, trigger: "blur" },
          //{ required: true, message: "请输入项目编号", trigger: "change" },
        ],
        projectPerson: [
          { required: true, message: "请输入负责人", trigger: "change" },
        ],
        projectSecretary: [
          { required: true, message: "请选择科研秘书", trigger: "change" },
        ],
        projectPersontype: [
          { required: true, message: "请选择负责人类型", trigger: "change" },
        ],
        projectYear: [
          { required: true, message: "请选择立项年度", trigger: "change" },
        ],
        projectWritetime: [
          { required: true, message: "请填写登记时间", trigger: "change" },
        ],
        specialMoney: [
          { required: true, message: "请输入专项经费", trigger: "blur" },
        ],
        projectSubject: [
          { required: true, message: "请选择学科门类", trigger: "change" },
        ],
        projectStarttime: [
          { required: true, message: "请输入项目开始时间", trigger: "change" },
        ],
        projectEndtime: [
          { required: true, message: "请输入项目结束时间", trigger: "change" },
        ],
        projectStudytype: [
          { required: true, message: "请选择研究类型", trigger: "change" },
        ],
        projectType: [
          { required: true, message: "请选择项目类型", trigger: "blur" },
        ],
        projectLevel: [
          { required: true, message: "请输入项目级别", trigger: "blur" },
        ],
        //this.Info.touchPerson
        personRemark: [
          { required: true, message: "请输入详细信息", trigger: "blur" },
        ],
        //this.Info.projectEntrust
        projectRemark: [
          { required: true, message: "请输入详细信息", trigger: "blur" },
        ],
      },
    };
  },
  computed: {
    sumSpecialMoney() {
      let num = 0;
      if (this.Fundtemplate_ItemListZ.length == 0) {
        return num;
      }
      if (this.Fundtemplate_ItemListJ.length == 0) {
        return num;
      }
      this.Fundtemplate_ItemListZ.forEach((element) => {
        num += Number(element.directFunding);
      });
      this.Fundtemplate_ItemListJ.forEach((element) => {
        num += Number(element.directFunding);
      });
      return num;
    },
    sumSupportMoney() {
      let num = 0;
      if (this.Fundtemplate_ItemListZ.length == 0) {
        return num;
      }
      if (this.Fundtemplate_ItemListJ.length == 0) {
        return num;
      }
      this.Fundtemplate_ItemListZ.forEach((element) => {
        num += Number(element.overheadFunding);
      });
      this.Fundtemplate_ItemListJ.forEach((element) => {
        num += Number(element.overheadFunding);
      });
      return num;
    },
  },
  created() {
    this.Show();
  },
  methods: {
    GetDepart(val) {
      this.this.projectDepartperson = val;
    },
    GetUpdate(item) {
      this.NumberofpersonnelList[item - 1].participantsName = "";
    },
    AddDepart(val) {
      this.projectDepartresult = val;
    },
    DateJudge(StartTime, EndTime, item) {
      console.log(StartTime, EndTime, item);
      if (StartTime > EndTime && StartTime != "" && EndTime != "") {
        this.$message("开始时间不能大于结束时间!");
        this.PlanAndObjectivesList[item - 1].endTime = "";
      }
    },
    DelExpectedSuccess(item) {
      this.ExpectedSuccess.splice(item - 1, 1);
    },
    AddExpectedSuccess() {
      var list = {
        results: "",
        //projectId: "string"
      };
      this.ExpectedSuccess.push(list);
    },
    DelPlanAndObjectivesList(item) {
      this.PlanAndObjectivesList.splice(item - 1, 1);
    },
    AddPlanAndObjectivesList() {
      var list = {
        startTime: "",
        endTime: "",
        plan: "",
        target: "",
        //projectId: ""
      };
      this.PlanAndObjectivesList.push(list);
    },
    AddNumberofpersonnel() {
      var list = {
        participantsType: 0, //参与人类别
        participantsName: "", //参与人姓名
        affiliatedUnit: "", //所属单位
        participantsJob: "", //参与人现专业技术职务
        projectQuantity: 0, //现参与项目数量
        projectDivision: "", //责任分工
        workingHours: 0, //投入本项目计划工作时间
        salary: 0, //每月资助标准
      };
      this.NumberofpersonnelList.push(list);
    },
    DelNumberofpersonnel(item) {
      this.NumberofpersonnelList.splice(item - 1, 1);
    },
    querySearchAsync(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createStateFilter(queryString))
        : restaurants;
      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      });
    },
    IncludingAccessories() {
      if (this.Isdisable == false && this.Info.supportMoney > 0) {
        this.$confirm(
          "您已填写配套经费，若执行此操作配套经费将被清空！！！",
          "提示",
          {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }
        )
          .then(() => {
            this.$message({
              type: "success",
              message: "配套经费已清空!",
            });
            this.Info.supportMoney = 0;
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消",
            });
            this.Isdisable = true;
          });
      }
    },
    BegindisabledDateFun(time) {
      //console.log(new Date(this.Info.projectEndtime))
      if (this.Info.projectEndtime != undefined) {
        if (time.getTime() > new Date(this.Info.projectEndtime)) {
          // Date.now() > time.getTime()
          // >new Date(this.Info.projectEndtime)
          return true;
        } else {
          return false;
        }
      }
      if (time.getTime() < Date.now() - 8.64e7) {
        return true;
      } else {
        return false;
      }
    },
    EnddisabledDateFun(time) {
      //console.log(new Date(this.Info.projectStarttime))
      if (this.Info.projectStarttime != undefined) {
        if (time.getTime() < new Date(this.Info.projectStarttime)) {
          return true;
        } else {
          return false;
        }
      } else {
        if (time.getTime() < Date.now() - 8.64e7) {
          return true;
        } else {
          return false;
        }
      }
    },
    querySearchAsync1(queryString, cb) {
      var restaurants = this.restaurants1;
      var results = queryString
        ? restaurants.filter(this.createStateFilter(queryString))
        : restaurants;
      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      });
    },
    createStateFilter(queryString) {
      return (state) => {
        return (
          state.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1
        );
      };
    },
    handleSelect(item) {
      console.log(item);
      //alert(item.depId)
      if (item.value == this.Info.projectSecretary) {
        this.$message("项目负责人不能是科研秘书");
        this.Info.projectPerson = undefined;
        return;
      }
      this.http.get("api/depart/DepartSearch?id=" + item.depId).then((res) => {
        console.log(res);
        this.Info.projectDepartperson = res[0].departmentName;
      });
      this.http
        .get("api/depart/GetResponsibleUnit?id=" + item.depId)
        .then((res) => {
          console.log(res);
          this.Info.projectUndertakeunit = res.departmentName;
        });
    },
    handleSelect1(item) {
      console.log(item);
      if (item.value == this.Info.projectPerson) {
        this.$message("科研秘书不能是项目负责人");
        this.Info.projectSecretary = undefined;
        return;
      }
      this.Info.secretaryPhone = item.phone;
    },
    Show() {
      // this.$router.go(0)
      // http://localhost:9991/api/tb_project_tsinfo/GetTsBaseInfoById?Id=1642441766894440448
      this.http
        .get(
          "api/tb_project_tsinfo/GetTsBaseInfoById?Id=" + this.$route.query.id
        )
        .then((res) => {
          if (res != null) {
            console.log(res);
            var BaseInfo = JSON.parse(res.projectInfo);
            console.log(BaseInfo);
            this.Info = BaseInfo.Info;
            if (BaseInfo.Info.projectType != "") {
              this.http
                .get(
                  "api/tb_project_sourceinfo/GetSourceList?dicCode=" +
                    BaseInfo.Info.projectType
                )
                .then((res) => {
                  console.log(res);
                  this.projectLevelOptions = res.data;
                });
            }
            if (BaseInfo.Info.projectLevel != "") {
              this.http
                .get(
                  "api/tb_project_sourceinfo/GetSourceList?dicCode=" +
                    BaseInfo.Info.projectLevel
                )
                .then((res) => {
                  console.log(res);
                  this.projectScoreunitOptions = res.data;
                });
            }
            if (BaseInfo.Info.projectScoreunit != "") {
              this.http
                .get(
                  "api/tb_project_sourceinfo/GetSourceList?dicCode=" +
                    BaseInfo.Info.projectScoreunit
                )
                .then((res) => {
                  console.log(res);
                  this.projectKindOptions = res.data;
                });
              this.http
                .get(
                  "api/tb_project_type_template/GetTemplateList?TypeId=" +
                    BaseInfo.Info.projectScoreunit
                )
                .then((res) => {
                  console.log(res);
                  this.options = res.result.data;
                });
            }
            if (BaseInfo.BudgetTemplate != "") {
              this.loading = true;
              this.http
                .get(
                  "api/Tb_Project_Templatesubject_Relationship/Get_Fundtemplate_ItemList?fundtemplateId=" +
                    BaseInfo.BudgetTemplate
                )
                .then((res) => {
                  this.Fundtemplate_ItemList = res.data.directFunding;
                  this.indirectCosts = res.data.indirectCosts;
                  this.loading = false;
                });
              this.BudgetTemplate = BaseInfo.BudgetTemplate;
            }
            this.Fundtemplate_ItemListJ = BaseInfo.Fundtemplate_ItemListJ;
            this.Fundtemplate_ItemListZ = BaseInfo.Fundtemplate_ItemListZ;
            this.ExpectedSuccess = BaseInfo.Info.dataone;
            this.NumberofpersonnelList = BaseInfo.Info.datatwo;
            this.PlanAndObjectivesList = BaseInfo.Info.datathree;
            // console.log(this.Info)
          }
        });
      this.http.get("api/depart/DepartShow").then((res) => {
        console.log(res);
      });
      this.http.get("api/depart/DepartGetList").then((res) => {
        console.log(res);
        this.restaurants = res;
      });
      this.http.get("api/User/GetSecretaryListAsync").then((res) => {
        console.log(res);
        this.restaurants1 = res.data;
      });
      this.http.get("api/depart/DepartShow").then((res) => {
        console.log(res);
        this.DepartList = res;
      });
      this.http.get("api/tb_project_sourceinfo/GetSourceList").then((res) => {
        console.log(res);
        this.projectTypeOptions = res.data;
      });
      //负责人类型
      this.http
        .get("api/Sys_Dictionary/GetDictionaryDescList?Dic_ID=77")
        .then((res) => {
          console.log(res);
          this.projectPersontypeOptions = res.result.data;
        });
      //学科门类
      this.http
        .get("api/Sys_Dictionary/GetDictionaryDescList?Dic_ID=78")
        .then((res) => {
          console.log(res);
          this.projectSubjectOptions = res.result.data;
        });
      //研究类型
      this.http
        .get("api/Sys_Dictionary/GetDictionaryDescList?Dic_ID=79")
        .then((res) => {
          console.log(res);
          this.projectStudytypeOptions = res.result.data;
        });
      //项目承担单位
      this.http
        .get("api/Sys_Dictionary/GetDictionaryDescList?Dic_ID=80")
        .then((res) => {
          console.log(res);
          this.projectUndertakeunitOptions = res.result.data;
        });
    },
    Get_Fundtemplate_ItemList() {
      this.loading = true;
      this.http
        .get(
          "api/Tb_Project_Templatesubject_Relationship/Get_Fundtemplate_ItemList?fundtemplateId=" +
            this.BudgetTemplate
        )
        .then((res) => {
          console.log(this.BudgetTemplate);
          console.log(res);
          this.Fundtemplate_ItemList = res.data.directFunding;
          console.log(this.Fundtemplate_ItemList);
          this.indirectCosts = res.data.indirectCosts;
          console.log(this.indirectCosts);
          this.Fundtemplate_ItemListZ = [];
          this.Fundtemplate_ItemListJ = [];
          for (var i = 0; i < this.Fundtemplate_ItemList.length; i++) {
            this.Fundtemplate_ItemListZ.push({
              templateId: this.BudgetTemplate, //经费模板Id
              subjectId: this.Fundtemplate_ItemList[i].budgetItemId, //经费科目Id
              directFunding: 0, //专项经费
              overheadFunding: 0, //配套经费
            });
          }
          console.log(this.Fundtemplate_ItemListZ);
          console.log("111111111111111111111111111111");
          for (var i = 0; i < this.indirectCosts.length; i++) {
            this.Fundtemplate_ItemListJ.push({
              templateId: this.BudgetTemplate, //经费模板Id
              subjectId: this.indirectCosts[i].budgetItemId, //经费科目Id
              directFunding: 0, //专项经费
              overheadFunding: 0, //配套经费
              //key: Date.now() + i,
            });
          }
          console.log(this.Fundtemplate_ItemListJ);
          console.log("2222222222222222222222222222222");
          this.loading = false;
        });
    },
    submitForm(ruleForm) {
      if (!this.Info.projectEntrust) {
        this.Info.projectRemark = "无";
      }
      if (!this.Info.touchPerson) {
        this.Info.personRemark = "无";
      }
      console.log("9999999999999999999999999999");
      let i = 0;
      this.$refs[ruleForm].validate((valid) => {
        console.log(i + ":" + valid);
        i++;
        if (valid) {
          if (this.BudgetTemplate == undefined) {
            this.$message("请选择经费模板");
            return;
          }
          if (this.sumSpecialMoney != this.Info.specialMoney * 10) {
            this.$message("专项经费不匹配");
            return;
          }
          if (this.sumSupportMoney != this.Info.supportMoney * 10) {
            this.$message("配套经费不匹配");
            return;
          }
          this.Fundtemplate_ItemListJ.forEach((element) => {
            this.Info.data.push(element);
          });
          this.Fundtemplate_ItemListZ.forEach((element) => {
            this.Info.data.push(element);
          });
          if (this.Info.file.length == 0) {
            this.$message("请添加附件");
            return;
          }
          if (this.PlanAndObjectivesList.length == 0) {
            this.$message("请至少填写一条计划与目标信息");
          }
          if (this.ExpectedSuccess.length == 0) {
            this.$message("请至少填写一条预期成果信息");
          }
          if (this.NumberofpersonnelList.length == 0)
            [this.$message("请至少填写一条参与人信息")];
          this.Info.dataone = this.ExpectedSuccess;
          this.Info.datatwo = this.NumberofpersonnelList;
          this.Info.datathree = this.PlanAndObjectivesList;
          this.Info.projectDepartperson =
            this.Info.projectDepartperson.toString();
          this.Info.projectDepartresult = this.projectDepartresult.toString();
          this.Info.projectEndtime =
            new Date(this.Info.projectEndtime).getFullYear() +
            "-" +
            (new Date(this.Info.projectEndtime).getMonth() + 1);
          this.Info.projectStarttime =
            new Date(this.Info.projectStarttime).getFullYear() +
            "-" +
            (new Date(this.Info.projectStarttime).getMonth() + 1);
          this.Info.projectYear = parseInt(
            new Date(this.Info.projectYear).getFullYear()
          );
          //console.log(this.Info.projectWritetime.getFullYear() + '-' + (this.Info.projectWritetime.getMonth() + 1) + '-' + this.Info.projectWritetime.getDate())
          // this.Info.projectWritetime = this.Info.projectWritetime.getFullYear() + '-' + (this.Info.projectWritetime.getMonth() + 1) + '-' + this.Info.projectWritetime.getDate()
          alert("11111111111");
          console.log(this.Info);
          this.http
            .post("api/tb_project_baseinfo/ProductInfoAddTsAsync", this.Info)
            .then((res) => {
              console.log(res);
              if (res.status) {
                this.$message("添加成功！");
                this.$router.push("/ProjectList");
              } else {
                this.$message("添加失败！");
              }
            });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    Upic(val) {
      console.log(val);
      if (val.code) {
        var list = {
          appendixUrl: val.filePath,
          appendixName: val.fileName,
          //projectID: ""
        };
        this.Info.file.push(list);
      } else {
        this.$message(val.message);
      }
    },
    Staging() {
      this.Info.dataone = this.ExpectedSuccess;
      this.Info.datatwo = this.NumberofpersonnelList;
      this.Info.datathree = this.PlanAndObjectivesList;
      var BaseInfo = {
        Fundtemplate_ItemListJ: this.Fundtemplate_ItemListJ,
        Fundtemplate_ItemListZ: this.Fundtemplate_ItemListZ,
        Info: this.Info,
        BudgetTemplate: this.BudgetTemplate,
      };
      var Ts = JSON.stringify(BaseInfo);
      var list = {
        userId: JSON.parse(localStorage.getItem("user")).userName,
        projectName: this.Info.projectName,
        projectInfo: Ts,
        projectCreateTime: new Date(),
        transientType: 0,
      };
      console.log(BaseInfo);
      this.http
        .post("api/tb_project_tsinfo/InsertTsInfoAsync", list)
        .then((res) => {
          console.log(res);
          if (res.status) {
            this.$message("暂存成功！");
            this.$router.push("/TemporaryStorage");
          } else {
            this.$message("暂存失败！");
          }
        });
    },
    typeProjectLevel() {
      //this.projectType=this.Info.projectType
      this.Info.projectScoreunit = undefined;
      this.Info.projectLevel = undefined;
      this.Info.projectKind = undefined;
      (this.BudgetTemplate = undefined), (this.projectLevelOptions = []);
      this.projectKindOptions = [];
      this.projectScoreunitOptions = [];
      this.indirectCosts = [];
      this.Fundtemplate_ItemListZ = [];
      this.Fundtemplate_ItemListJ = [];
      this.Fundtemplate_ItemList = [];
      this.options = [];
      console.log(this.Info.projectType);
      this.http
        .get(
          "api/tb_project_sourceinfo/GetSourceList?dicCode=" +
            this.Info.projectType
        )
        .then((res) => {
          console.log(res);
          this.projectLevelOptions = res.data;
        });
    },
    projectScoreunitLevel() {
      (this.Info.projectKind = undefined),
        (this.BudgetTemplate = undefined),
        (this.indirectCosts = []);
      this.Fundtemplate_ItemListZ = [];
      this.Fundtemplate_ItemListJ = [];
      this.Fundtemplate_ItemList = [];
      console.log(this.Info.projectScoreunit);
      this.http
        .get(
          "api/tb_project_sourceinfo/GetSourceList?dicCode=" +
            this.Info.projectScoreunit
        )
        .then((res) => {
          console.log(res);
          this.projectKindOptions = res.data;
        });
      this.http
        .get(
          "api/tb_project_type_template/GetTemplateList?TypeId=" +
            this.Info.projectScoreunit
        )
        .then((res) => {
          console.log(res);
          this.options = res.result.data;
        });
    },
    projectLevelLevel() {
      this.options = [];
      this.indirectCosts = [];
      this.Fundtemplate_ItemList = [];
      this.Fundtemplate_ItemListZ = [];
      this.Fundtemplate_ItemListJ = [];
      (this.BudgetTemplate = undefined), (this.Info.projectKind = undefined);
      this.Info.projectScoreunit = undefined;
      this.projectScoreunitOptions = [];
      this.projectKindOptions = [];
      console.log(this.Info.projectLevel);
      this.http
        .get(
          "api/tb_project_sourceinfo/GetSourceList?dicCode=" +
            this.Info.projectLevel
        )
        .then((res) => {
          console.log(res);
          this.projectScoreunitOptions = res.data;
        });
    },
    sumMoney() {
      if (this.Info.specialMoney == undefined) {
        return;
      }
      if (this.Info.specialMoney <= 0) {
        this.$message("专项经费不能小于等于0");
        this.Info.specialMoney = undefined;
        return;
      }
      if (this.Info.supportMoney == undefined) {
        this.Info.projectMoney = this.Info.specialMoney;
        return;
      }
      this.Info.projectMoney =
        Number(this.Info.supportMoney) + Number(this.Info.specialMoney);
    },
    sumMoney1() {
      if (this.Info.supportMoney == undefined) {
        return;
      }
      if (this.Info.supportMoney < 0) {
        this.$message("配套经费不能小于0");
        this.Info.supportMoney = undefined;
        return;
      }
      if (this.Info.specialMoney == undefined) {
        this.Info.projectMoney = this.Info.supportMoney;
        return;
      }
      this.Info.projectMoney =
        Number(this.Info.supportMoney) + Number(this.Info.specialMoney);
    },
    isprojectSecretary() {
      if (
        this.Info.projectSecretary == this.Info.projectPerson &&
        this.Info.projectSecretary != "" &&
        this.Info.projectPerson != ""
      ) {
        this.$message("科研秘书不能是项目负责人");
        this.Info.projectSecretary = undefined;
        return;
      }
    },
    isprojectPerson() {
      if (
        this.Info.projectSecretary == this.Info.projectPerson &&
        this.Info.projectSecretary != "" &&
        this.Info.projectPerson != ""
      ) {
        this.$message("项目负责人不能是科研秘书");
        this.Info.projectPerson = undefined;
        return;
      }
    },
    handleChange(value) {
      console.log(value);
      if (value == null) {
        value = 0;
      }
    },
    ProjectUndertakingUnit() {
      //alert(Info.projectDepartperson)
      console.log(this.Info.projectDepartperson);
    },
  },
};
</script>

<style>
/* table {
  border-collapse: collapse;
  width: 100%;
} */

/* tbody {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  height: 220px;
} */

/* thead,
tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
  word-break: break-all;
} */

.text___size {
  font-size: 10px;
}

.ipt {
  border: none;
  outline: none;
  height: 30px;
  border-bottom: 1px solid #ccc;
}

.table_style {
  border: 1px solid #ccc;
  height: 50px;
  text-align: center;
}

.table_style1 {
  border: 1px solid #ccc;
  height: 50px;
  width: 50px;
  text-align: center;
}

/* .el-input__inner{
    border: none;
    outline: none;
    height: 30px;
    border-bottom: 1px solid #ccc;
} */
/* .el-input /deep/ .el-input__wrapper {
    border: none;
    outline: none;
    height: 30px;
    border-bottom: 1px solid #ccc;
    
}  */
/* .el-input .el-input--default .el-input__wrapper{
    border: none;
} */
.el-input__wrapper {
  display: inline-flex;
  flex-grow: 1;
  align-items: center;
  justify-content: center;
  padding: 1px 11px;
  background-color: var(--el-input-bg-color, var(--el-fill-color-blank));
  background-image: none;
  border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
  transition: var(--el-transition-box-shadow);
  box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color))
    inset;
  border-bottom: 1px solid;
}

.table {
  table-layout: fixed;
  width: 100%;
}

.thead {
  position: sticky;
  top: 0;
}

.el-form-item.is-error .el-input__wrapper {
  box-shadow: 0 0 0 1px #ffffff inset;
}

.el-input__wrapper.is-focus {
  box-shadow: 0 0 0 1px white inset;
}

.el-input {
  --el-input-text-color: var(--el-text-color-regular);
  --el-input-border: var(--el-border);
  --el-input-hover-border: var(--el-border-color-hover);
  --el-input-focus-border: var(--el-color-primary);
  --el-input-transparent-border: 0 0 0 1px transparent inset;
  --el-input-border-color: var(--el-border-color);
  --el-input-border-radius: var(--el-border-radius-base);
  --el-input-bg-color: var(--el-fill-color-blank);
  --el-input-icon-color: var(--el-text-color-placeholder);
  --el-input-placeholder-color: var(--el-text-color-placeholder);
  --el-input-hover-border-color: #ffffff;
  --el-input-clear-hover-color: var(--el-text-color-secondary);
  --el-input-focus-border-color: var(--el-color-primary);
}

.el-select {
  --el-select-border-color-hover: #ffffff;
  --el-select-disabled-border: var(--el-disabled-border-color);
  --el-select-font-size: var(--el-font-size-base);
  --el-select-close-hover-color: var(--el-text-color-secondary);
  --el-select-input-color: var(--el-text-color-placeholder);
  --el-select-multiple-input-color: var(--el-text-color-regular);
  --el-select-input-focus-border-color: #ffffff;
  --el-select-input-font-size: 14px;
}

.el_Select /deep/ :root {
  color-scheme: light;
  --el-color-white: #ffffff;
  --el-color-black: #000000;
  --el-color-primary: none;
  --el-color-primary-light-3: #79bbff;
  --el-color-primary-light-5: #a0cfff;
  --el-color-primary-light-7: #c6e2ff;
  --el-color-primary-light-8: #d9ecff;
  --el-color-primary-light-9: #ecf5ff;
  --el-color-primary-dark-2: #337ecc;
  --el-color-success: #67c23a;
  --el-color-success-light-3: #95d475;
  --el-color-success-light-5: #b3e19d;
  --el-color-success-light-7: #d1edc4;
  --el-color-success-light-8: #e1f3d8;
  --el-color-success-light-9: #f0f9eb;
  --el-color-success-dark-2: #529b2e;
  --el-color-warning: #e6a23c;
  --el-color-warning-light-3: #eebe77;
  --el-color-warning-light-5: #f3d19e;
  --el-color-warning-light-7: #f8e3c5;
  --el-color-warning-light-8: #faecd8;
  --el-color-warning-light-9: #fdf6ec;
  --el-color-warning-dark-2: #b88230;
  --el-color-danger: #f56c6c;
  --el-color-danger-light-3: #f89898;
  --el-color-danger-light-5: #fab6b6;
  --el-color-danger-light-7: #fcd3d3;
  --el-color-danger-light-8: #fde2e2;
  --el-color-danger-light-9: #fef0f0;
  --el-color-danger-dark-2: #c45656;
  --el-color-error: #f56c6c;
  --el-color-error-light-3: #f89898;
  --el-color-error-light-5: #fab6b6;
  --el-color-error-light-7: #fcd3d3;
  --el-color-error-light-8: #fde2e2;
  --el-color-error-light-9: #fef0f0;
  --el-color-error-dark-2: #c45656;
  --el-color-info: #909399;
  --el-color-info-light-3: #b1b3b8;
  --el-color-info-light-5: #c8c9cc;
  --el-color-info-light-7: #dedfe0;
  --el-color-info-light-8: #e9e9eb;
  --el-color-info-light-9: #f4f4f5;
  --el-color-info-dark-2: #73767a;
  --el-bg-color: #ffffff;
  --el-bg-color-page: #f2f3f5;
  --el-bg-color-overlay: #ffffff;
  --el-text-color-primary: #303133;
  --el-text-color-regular: #606266;
  --el-text-color-secondary: #909399;
  --el-text-color-placeholder: #a8abb2;
  --el-text-color-disabled: #c0c4cc;
  --el-border-color: #dcdfe6;
  --el-border-color-light: #e4e7ed;
  --el-border-color-lighter: #ebeef5;
  --el-border-color-extra-light: #f2f6fc;
  --el-border-color-dark: #d4d7de;
  --el-border-color-darker: #cdd0d6;
  --el-fill-color: #f0f2f5;
  --el-fill-color-light: #f5f7fa;
  --el-fill-color-lighter: #fafafa;
  --el-fill-color-extra-light: #fafcff;
  --el-fill-color-dark: #ebedf0;
  --el-fill-color-darker: #e6e8eb;
  --el-fill-color-blank: #ffffff;
  --el-box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.04),
    0px 8px 20px rgba(0, 0, 0, 0.08);
  --el-box-shadow-light: 0px 0px 12px rgba(0, 0, 0, 0.12);
  --el-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, 0.12);
  --el-box-shadow-dark: 0px 16px 48px 16px rgba(0, 0, 0, 0.08),
    0px 12px 32px rgba(0, 0, 0, 0.12), 0px 8px 16px -8px rgba(0, 0, 0, 0.16);
  --el-disabled-bg-color: var(--el-fill-color-light);
  --el-disabled-text-color: var(--el-text-color-placeholder);
  --el-disabled-border-color: var(--el-border-color-light);
  --el-overlay-color: rgba(0, 0, 0, 0.8);
  --el-overlay-color-light: rgba(0, 0, 0, 0.7);
  --el-overlay-color-lighter: rgba(0, 0, 0, 0.5);
  --el-mask-color: rgba(255, 255, 255, 0.9);
  --el-mask-color-extra-light: rgba(255, 255, 255, 0.3);
  --el-border-width: 1px;
  --el-border-style: solid;
  --el-border-color-hover: var(--el-text-color-disabled);
  --el-border: var(--el-border-width) var(--el-border-style)
    var(--el-border-color);
  --el-svg-monochrome-grey: var(--el-border-color);
}
</style>
<!-- 雪花id包
npm install snowflake-id -->